//
//  OrderDetailTopCell.m
//  didacar
//
//  Created by 度周末网络-王腾 on 16/1/11.
//  Copyright © 2016年 dzmmac. All rights reserved.
//

#import "OrderDetailTopCell.h"

@implementation OrderDetailTopCell

-(void)awakeFromNib{
    
    UIView *topLine = [CommoneTools createLineWithFrame:CGRectMake(0, 39, [UIScreen width], 0.45)];
    
    [self.topView addSubview:topLine];
    
    UIView *bottomLine = [CommoneTools createLineWithFrame:CGRectMake(0, 0, [UIScreen width], 0.45)];
    [self.bottomView addSubview:bottomLine];
    
}


-(void)setOrderDetailRegularBusModel:(OrderDetailRegularBusModel *)entity{
    if (entity == nil) {
        return;
    }

    // 支付方式
    [self setOrderStatusText:entity.PayType];
    
    // 上车点
    [BaseTableViewCell setBusLineStartLocationString:entity.StartStation startStationType:entity.StartStationType label:self.start];
    
    // 下车点
    self.end.text = entity.EndStation;
    
    self.price.text  = [NSString stringWithFormat:@"%@公里,约%@分钟",entity.Mileage.stringValue,@(entity.UserTime).stringValue];
    
    // 票价
    self.payPrice.attributedText = [self getPayPrice:entity.TicketOrderPrice.stringValue];
    
    self.orderNum.text = [NSString stringWithFormat:@"订单号:%@",entity.TicketOrderNum];
    
    self.time.text = entity.SendTime;
    
    self.orderTime.text = [NSString stringWithFormat:@"下单时间:%@",entity.CreatTime];
}


-(NSAttributedString *)getPayPrice:(NSString *)price{
    NSMutableArray *mutableString = [[NSMutableArray alloc ] init];
    
    [mutableString addObject:[MainInfoTitleFields getInstaceWithText:price hexColor:GLOBLE_ORANGE_COLOR_HEX fontSize:@"20"]];
    [mutableString addObject:[MainInfoTitleFields getInstaceWithText:@"元" hexColor:GLOBLE_ORANGE_COLOR_HEX fontSize:@"17"]];
    return [CommoneTools getAttributeString:mutableString];
}


-(void)setOrderStatusText:(NSInteger)orderStatus{
    if (orderStatus == 1) {
        self.orderStatus.text = @"支付宝支付";
    }else if (orderStatus == 2){
        self.orderStatus.text = @"微信支付";
    }else{
        self.orderStatus.text = @"";
    }
}

@end
